{% for schedule in schedule_list %}
    <tr class="row m-0{% if schedule.is_today %} table-primary {% endif %}">
        <th scope="row" class="col-3">{{ schedule.duty_date }}</th>
        <td class="col-2">{{ schedule.arrange_duty_person.name }}</td>
        <td class="col-2">{{ schedule.actual_duty_person.name }}</td>
        <td class="col-2">
            {% if not schedule.is_future %}
                {% if schedule.actual_duty_person %} <!-- 是否签到 -->
                    {% if schedule.is_arrangement %} <!-- 服从排班 -->
                        <button class="btn btn-sm btn-success disabled">已签到</button>
                    {% else %}
                        <button class="btn btn-sm btn-warning disabled">已换班签到</button>
                    {% endif %}
                {% else %}
                    <btn class="btn btn-sm btn-danger disabled">未签到</btn>
                {% endif %}
            {% endif %}
        </td>
        <td class="col-2">
            <div class="btn-group btn-group-sm">
                {% if schedule.is_today %}
                    {% if schedule.actual_duty_person %}
                        {% if schedule.is_arrangement %}
                            <button class="btn btn-sm btn-secondary disabled">签到</button>
                            <button class="btn btn-sm btn-primary js-change-sign-in"
                                    data-url="{% url 'change_sign_in' pk=schedule.pk mode=mode %}">
                                换班签到
                            </button>
                        {% else %}
                            <button class="btn btn-sm btn-primary js-sign-in"
                                    data-url="{% url 'sign_in' pk=schedule.pk mode=mode %}">签到
                            </button>
                            <button class="btn btn-sm btn-secondary disabled">换班签到</button>
                        {% endif %}
                    {% else %}
                        <button class="btn btn-sm btn-primary js-sign-in"
                                data-url="{% url 'sign_in' pk=schedule.pk mode=mode %}">
                            签到
                        </button>
                        <button class="btn btn-sm btn-primary js-change-sign-in"
                                data-url="{% url 'change_sign_in' pk=schedule.pk mode=mode %}">换班签到
                        </button>
                    {% endif %}
                {% elif schedule.is_past_due %}
                    <button class="btn btn-sm btn-secondary disabled">签到</button>
                    <button class="btn btn-sm btn-secondary disabled">换班签到</button>
                {% endif %}
            </div>
        </td>
        <td class="col-1">
            <button class="btn btn-sm btn-primary js-update-schedule"
                    data-url="{% url 'update_schedule' pk=schedule.pk %}">
                修改
            </button>
        </td>
    </tr>
{% empty %}
    <tr>
        <td colspan="4" class="text-center bg-warning">值班表未创建</td>
    </tr>
{% endfor %}